﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Wix.Aura.Common;
using Wix.Aura.Common.CustomTypes;

namespace Wix.Aura.UnitTests.Common {
	[TestFixture]
	public class AppIdSerialization : ProductChildren {
		[Test]
		public void TestIdParameter() {
			Guid id = Guid.NewGuid();

			string expected = string.Format(@"<AppId Id=""{0}"" />", id.ToString().ToUpper());
			expected = string.Format(baseXml, expected);

		    AppId appId = new AppId(id);
			project.Product.AppId.Add(appId);

			Assertion(expected, project);
		}

		[Test]
		public void AllAttributes() {
			Guid id = Guid.NewGuid();

			string expected = string.Format(@"<AppId Id=""{0}"" ActivateAtStorage=""yes"" Advertise=""yes"" Description=""Description"" DllSurrogate=""DllSurrogate"" LocalService=""LocalService"" RemoteServerName=""RemoteServerName"" RunAsInteractiveUser=""yes"" ServiceParameters=""ServiceParameters"" />", id.ToString().ToUpper());
			expected = string.Format(baseXml, expected);

			AppId appId = new AppId(id);

			appId.ActivateAtStorage = YesNoType.Yes;
			appId.Advertise = YesNoType.Yes;
			appId.Description = "Description";
			appId.DllSurrogate = "DllSurrogate";
			appId.LocalService = "LocalService";
			appId.RemoteServerName = "RemoteServerName";
			appId.RunAsInteractiveUser = YesNoType.Yes;
			appId.ServiceParameters = "ServiceParameters";

			project.Product.AppId.Add(appId);

			Assertion(expected, project);
		}
	}
}
